// logical_and example
#include <iostream>     //std::cout ,std::boolalpha
#include <functional>   //std::logical_and
#include <algorithm>    //std::transform
using namespace std;
int main()
{
    bool foo[] = {true,false,true,false};
    bool bar[] = {true,true,false,false};
    bool result[4];
    transform(foo,foo+4,bar,result,logical_and<bool>());
    cout << boolalpha << "Logical ANd:\n";
    for(int i = 0;i<4;i++)
        cout << foo[i] << " AND " << bar[i] << " = " << result[i] << "\n";
    return 0;
}